import openai
import os

from langchain.llms import OpenAI

from langchain.chat_models import ChatOpenAI
from langchain.schema import HumanMessage, SystemMessage, AIMessage




openai.api_key = "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"
openai.api_base = "https://openai.naraka.top/v1"

model = "gpt-3.5-turbo"

llm = OpenAI(openai_api_key=openai.api_key, openai_api_base=openai.api_base)

prompt = "今天是星期一，明天是星期三，这种说法有没有问题？"

response = llm(prompt)
print(response)
print(llm.model_name)


#
# chat = ChatOpenAI(temperature=.7, openai_api_key=openai_api_key)
#
# chat(
#     [
#         SystemMessage(content="你是一个很棒的粤菜点餐的人工智能机器人,可以帮助用户在一个简短的句子中弄清楚该吃什么"),
#         HumanMessage(content="我喜欢西红柿,我应该吃什么?")
#     ]
# )

# def get_completion(prompt, model="gpt-3.5-trubo"):
#     message = [{"role": "user", "content": prompt}]
#
#     response = chatgpt.ChatCompletion.create(
#         model=model,
#         message=message,
#         temperature=0,
#     )
#     return response.choices[0].message["content"]
#
